#ifndef RELATED_PRODUCTS_H
#define RELATED_PRODUCTS_H
#include <map>
#include <set>
#include <string>
#include <queue>
using namespace std;

typedef pair<string, float> ProductSimilarityPair;

class ProductSimilarityPairCompare
{
  bool reverse;
public:
  ProductSimilarityPairCompare(const bool& revparam=false)
    {reverse=revparam;}
  bool operator() (const ProductSimilarityPair& lhs, const ProductSimilarityPair&rhs) const
  {
    if (reverse) return (lhs.second > rhs.second);
    else return (lhs.second < rhs.second);
  }
};

typedef priority_queue<ProductSimilarityPair, vector<ProductSimilarityPair>, ProductSimilarityPairCompare> SimilarProductsQueue;

class RelatedProducts
{
public:
    RelatedProducts(map<string, set<string> > product_user_set_map, size_t max_recommend_num);
    map<string, SimilarProductsQueue> related_products_map;
};

#endif // RELATED_PRODUCTS_H
